<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.hbyj.hbm.vo.*"%>
<%@page import="com.hbyj.util.ChangeTool"%>
<%@page import="java.text.SimpleDateFormat"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

Members mbInfo = (Members)request.getSession().getAttribute("SysUser");
String lyCode = mbInfo.getLyCode();
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date datetime = new Date();
String time = date.format(datetime);

int flag = ChangeTool.ChangeArea(lyCode).length();
String shengName = "";String shiName = "";String xianName = "";
String shengCode = "";String shiCode = "00";String xianCode = "00";
if(flag==2){
	shengCode = lyCode;
	shengName = ChangeTool.getFinalValue(lyCode);
}else if(flag==4){
	shengCode = lyCode.substring(0,2)+"0000";
	shengName = ChangeTool.getFinalValue(shengCode);
	shiCode = lyCode.substring(0,4)+"00";
	shiName = ChangeTool.getFinalValue(shiCode);
}else if(flag==6){
	shengCode = lyCode.substring(0,2)+"0000";
	shengName = ChangeTool.getFinalValue(shengCode);
	shiCode = lyCode.substring(0,4)+"00";
	shiName = ChangeTool.getFinalValue(shiCode);
	xianCode = lyCode;
	xianName = ChangeTool.getFinalValue(xianCode);
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   
    
    <title>My JSP 'zbPersonManager.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="css/zbCss/pageTable.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="../../style/zbCss/defaultStyle.css" />
	<link rel="stylesheet" type="text/css" href="../../style/zbCss/easyui.css" />
	<link rel="stylesheet" type="text/css" href="../../style/zbCss/icon.css" />
	<link rel="stylesheet" type="text/css" href="../../style/zbCss/pageTable.css" />
	<link rel="stylesheet" type="text/css" href="../../lib/fusionChart/Style.css" />

	 <script type="text/javascript" src="../../lib/data.js"></script>
	  <script type="text/javascript" src="../../js/yjzsfunctiondlg/zbgl.js"></script>
	<script type="text/javascript" src="../../lib/easyui/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="../../lib/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../lib/easyui/json2.js"></script>
	<script type="text/javascript"src="../../My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"src="../../lib/fusionChart/FusionCharts.js"></script>
	
	<script type="text/javascript"src="../../lib/fullcalendar/fullcalendar.js"></script>
		<link rel='stylesheet' type='text/css' href='../../lib/fullcalendar/fullcalendar.css' />
	<link rel='stylesheet' type='text/css' href='../../lib/fullcalendar/fullcalendar.print.css' media='print' />
	
	
		<script type="text/javascript">
		
		$(function(){
			
			$('#detailsDialog').dialog({
				draggable : true,
				top : 50,
				left : 100,
				title : "排班记录详情",
				collapsible : true
			});
			$('#detailsDialog_zbjl').dialog({
				draggable : true,
				top : 50,
				left : 100,
				title : "值班记录详情",
				collapsible : true
			});
			
			$('#zbtj_charDlg').dialog({
				draggable : true,
				top : 50,
				left : 100,
				title : "统计图",
				collapsible : true
			});
				$('#zbtj_charDlg').dialog("close");
			initTable();//格式化表格
			//getCurrentDutyLog('<%=mbInfo.getEmpName()%>');//获取当前登录人的未填写的值班日志
			$("#detailsDialog").dialog("close");
			$("#detailsDialog_zbjl").dialog("close");
			//setOption('china','sheng');
			setOption('china','shen_zbjl');
			initTblZBJL();//初始化值班记录datagrid
			$("#queryBtn_zbjl").bind('click',function(){return queryBtn_zbjl()});
			$("#exportBtn_zbjl").bind('click',function(){return exportBtn_zbjl()});
			var sort = '<%=flag%>';
			//setSltDefaultVal("sheng",<%=shengCode%>);
			setSltDefaultVal("shen_zbjl",<%=shengCode%>);
			$("#shen_zbjl").attr("disabled","disabled");
			//changeShengItem(document.getElementById("sheng").value,'addshi_zbgl');
			changeShengItem(document.getElementById("shen_zbjl").value,'shi_zbjl');
			
			//setOption('china','shen_zbry');
			//setOption('china','sheng_zbry');
			//loadZBRYSlt('sheng',<%=shengCode%>);
			//setSltDefaultVal("shen_zbry",<%=shengCode%>);
			//setSltDefaultVal("sheng_zbry",<%=shengCode%>);
			//$("#shen_zbry").attr("disabled","disabled");
			//changeShenItem(document.getElementById("shen_zbry").value,'shi_zbry');
			//changeShengItem(document.getElementById("sheng_zbry").value,'addshi_zbry');
			if(sort==4){//市级
				
				//setSltDefaultVal("shi_zbry",<%=shiCode%>);
				//changeShiItem($("#shi_zbry").val(),'xian_zbry');
				//$("#shi_zbry").attr("disabled","disabled");
				
				setSltDefaultVal("shi_zbjl",<%=shiCode%>);
				changeShiItem($("#shi_zbjl").val(),'xian_zbjl');
				$("#shi_zbjl").attr("disabled","disabled");
			}else if(sort==6){//县级
				
				//setSltDefaultVal("shi_zbry",<%=shiCode%>);
				//changeShiItem($("#shi_zbry").val(),'xian_zbry');
				//setSltDefaultVal("xian_zbry",<%=xianCode%>);
				//$("#shi_zbry").attr("disabled","disabled");
				//$("#xian_zbry").attr("disabled","disabled");
				
				setSltDefaultVal("shi_zbjl",<%=shiCode%>);
				changeShiItem($("#shi_zbjl").val(),'xian_zbjl');
				setSltDefaultVal("xian_zbjl",<%=xianCode%>);
				$("#shi_zbjl").attr("disabled","disabled");
				$("#xian_zbjl").attr("disabled","disabled");
			}
			
			$('#Dialog_addPbjl').dialog({
				draggable : true,
				top : 50,
				left : 100,
				title : "新增排班记录",
				collapsible : true,
				modal:true
			});
			$('#detailsDialog_zbry').dialog({
				draggable : true,
				top : 50,
				left : 100,
				title : "值班人员详情",
				collapsible : true
			});
			$('#Dialog_addzbry').dialog({
				draggable : true,
				top : 50,
				left : 100,
				title : "新增值班人员",
				collapsible : true,
				modal:true
			});
			initTable();
			$("#detailsDialog_zbry").dialog("close");
			$("#Dialog_addzbry").dialog("close");
			$("#Dialog_addPbjl").dialog("close");
			initTblZBRY();
			$("#queryBtn_zbry").bind('click',function(){return queryZBRYByKeyword()});
			$("#addBtn_zbry").bind('click',function(){return showDialogAddZbry()});
			
			//值班统计的初始化
			intTblZBTJ();
			
			$('#tabsdiv').tabs({
				
				onSelect:function(title){
					if(title=="值班"){
						//getCurrentDutyLog('<%=mbInfo.getEmpName()%>');//获取当前登录人的未填写的值班日志
					}
					if(title=="值班表"){
						$("#yjzb_ForCalendar").html("");
						initFullCalendarForYJZB();
					}
					if(title=="排班表"){
						$("#yjpb_ForCalendar").html("");
						initFullCalendarForYJPB();
					}
					if(title=="值班记录"){
						intTblZBTJ();
					}
				}
			});
			
		})
		</script>

  </head>
  
  <body >
  <div style="position: absolute;z-index: 10000;margin-left: 750px;margin-top: 6px">
  <input type="button" id="onDuty" value="值班" class="btn_2z" 
									onclick="forZhibanClickFunc('<%=mbInfo.getEmpName()%>')" /></div>	
  <div id="wrapper">
			
		<div id="tabsdiv" class="easyui-tabs" style="width:826px;height: 400px">
				<div title="排班表" style="padding: 0px;"
					id="">
					<div onclick="exportXLS('PBB')" style="position:absolute;right:150px;top:45px;width:100px;height:26px;border:1px solid black;line-height:26px;background-color:#97D7F7;text-align:center;cursor:pointer;">导出当月排班表</div>
				<div id="yjpb_ForCalendar" style="width:820px"></div>
				</div>
				<div title="值班表" style="padding: 0px;"
					id="">
					<div onclick="exportXLS('SJZB')" style="position:absolute;right:150px;top:45px;width:100px;height:26px;border:1px solid black;line-height:26px;background-color:#97D7F7;text-align:center;cursor:pointer;">导出当月值班表</div>
					<div id="yjzb_ForCalendar" style="width:820px"></div>
				</div>
				<div title="值班统计" style="padding: 0px;"
					id="">
					年：<select id="chooseYearSelect"><option selected="selected">请选择年份</option></select>
					月：<select id="chooseMonthSelect"><option selected="selected" value="">请选择月份</option>
						<option value="1">1月</option>
						<option value="2">2月</option>
						<option value="3">3月</option>
						<option value="4">4月</option>
						<option value="5">5月</option>
						<option value="6">6月</option>
						<option value="7">7月</option>
						<option value="8">8月</option>
						<option value="9">9月</option>
						<option value="10">10月</option>
						<option value="11">11月</option>
						<option value="12">12月</option>
					</select>
					<input type="button" id="tjBtn_zb" value="统计" class="btn_2z"
										onclick="" />
					<input type="button" id="charBtn_zb"  style="width:100px;height:20px;border:1px solid black;margin-left:200px;display: none;cursor: pointer;" value="统计图查看"  />
					<table id="tblZBTJ" width="820px" height="450px"></table>
				</div>
<%--				<div title="日志编辑" style="padding: 0px; display: none;"
					id="logManageDiv">
					
					<input type="hidden" id="addyjcz10000"/>
					
				</div>--%>
				
				<div title="值班记录查询" style="padding: 0px;height: 300px;width: 500px" id="areaProject">
					省：<select id="shen_zbjl" onchange="changeShenItem(this.value,'shi_zbjl')"><option  selected="selected" value="" >请选择省</option></select>
					市：<select id="shi_zbjl" onchange="changeShiItem(this.value,'xian_zbjl')"><option  selected="selected" value="">请选择市</option></select>
					县：<select id="xian_zbjl" ><option  selected="selected" value="">请选择县</option></select>
					值班姓名：<input id="qName_zbjl" type="text">
					<br/>
					值班时间（起）<input id="startTime_zbjl"  class="Wdate" type="text" onfocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" value="<%=ChangeTool.getBetweenTime()[0]%> 00:00:00"/>
					值班时间（止）<input id="endTime_zbjl" class="Wdate" type="text" onfocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" value="<%=ChangeTool.getBetweenTime()[1]%> 23:00:00"/>
					<input type="button" id="queryBtn_zbjl" value="搜索" class="btn_2z"
										onclick="" />
										<input type="button" id="exportBtn_zbjl" value="导出" class="btn_2z"
										onclick="" />
					<table id="tblZBJL" width="820px" height="450px"></table>
					</span>
				
				</div>
				
				
<%--				<div iconCls="icon-edit" title="值班" style="padding: 0px; display: none;"--%>
<%--					id="" >--%>
<%--					--%>
<%--					</div>--%>
<%--				<div title="值班人员维护" style="padding: 0px;height: 300px;width: 500px;" id="zbrymanager">
					省：<select id="shen_zbry" onchange="changeShenItem(this.value,'shi_zbry')"><option  selected="selected" value="" >请选择省</option></select>
					市：<select id="shi_zbry" onchange="changeShiItem(this.value,'xian_zbry')"><option  selected="selected" value="">请选择市</option></select>
					县：<select id="xian_zbry" onchange="changeXianItem(this.value,'zhen')"><option  selected="selected" value="">请选择县</option></select>
					姓名：<input id="qName_zbry" type="text">
					<input type="button" id="queryBtn_zbry" value="搜索" class="btn_2z"
										onclick="" />
										<input type="button" id="addBtn_zbry" value="新增" class="btn_2z"
										onclick="" />
					<input type="hidden" id="region" />
					<table id="tblZBRY" width="820px" height="450px"></table>
				</div>--%>
				
			</div>	
				
				
				
				
				
				
				
				
				
				
				
				
			</div>	
			</div>
	<div  id="detailsDialog" style="width:580px;height:300px;" >
	<input type="hidden" id="yjcz10000"/>
	<input type="hidden" id="yjcz10005"/>
	<table >
	
	<tr><td>值班单位</td><td><input type="text" id="yjcz10020"/></td><td>值班人员</td><td><input type="text" id="yjcz10050"/></td></tr>
	<tr><td>值班日期（起）</td>
	<td><input class="Wdate" 
	 onfocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" type="text" id="yjcz10030"/></td>
	 <td>值班日期（止）</td>
	 <td><input class="Wdate" type="text" id="yjcz10040"  onfocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})"/></td></tr>
	<tr><td>是否代班</td><td><input type="radio" name="yjcz10010" value="1">是<input type="radio" name="yjcz10010" value="0">否</td><td>带班领导</td><td><input type="text" id="yjcz10060"/></td></tr>
	<%--<tr><td>主管领导</td><td><input type="text" id="yjcz10070"/></td><td>分管领导</td><td><input type="text" id="yjcz10080"/></td></tr>--%>
	<tr><td>应急值班电话1</td><td><input type="text" id="yjcz10090"/></td><td>应急值班电话2</td><td><input type="text" id="yjcz10100"/></td></tr>
	<tr><td>应急值班电话3</td><td><input type="text" id="yjcz10110"/></td><td>值班坐席编号</td><td><input type="text" id="yjcz10120"/></td></tr>
	<tr><td>应急值班传真</td><td><input type="text" id="yjcz10130"/></td><td >备注</td><td ><input type="text" id="yjcz10150" /></td></tr>
	<tr><td>值班日志</td><td colspan="3"><input type="text" id="yjcz10140" size="62"/></td></tr>
	
	<tr id="btnTr">
	
	<td colspan="2" align="right"><input id="submitBtn"  type="button" value="保存" class="btn_2z"
					onclick="updateZBGL()" /></td>
					<td colspan="2"><input type="button" id="resetBtn" value="重置" class="btn_2z"
					onclick="resetEvent()" /></td></tr>
	</table>
	</div>
	
	
	<div  id="Dialog_addzbry" style="padding:5px;width:500px;height:310px;" >
	<input type="hidden" id="addyjcz09000"/>
					<select style="display: none" id="sheng_zbry" onchange="changeShengItem(this.value,'addshi_zbry')"><option  selected="selected" value="" >请选择省</option></select>
					<table class="innerStyle" style="width:100%;">
	<br/>
	<tr><td>值班单位</td><td><input type="text" id="addyjcz09020"/></td><td>值班人员</td><td><input type="text" id="addyjcz09030"/></td></tr>
	<tr><td>省市区划</td>
	<td><select id="addshi_zbry" 	onchange="changeShiItem(this.value,'addxian_zbry');">
	<option  selected="selected" value="-1">湖北省</option></select>
	<td>县级区划</td><td>
	<select id="addxian_zbry" onchange="changeXianItem(this.value,'zhen')">
	<option  selected="selected" value="-1">请选择县</option></select></td></tr>
	<tr><td>移动电话</td><td><input type="text" id="addyjcz09035"/></td><td>性别</td><td><input type="text" id="addyjcz09040"/></td></tr>
	<tr><td>办公电话</td><td><input type="text" id="addyjcz09050"/></td><td>办公传真</td><td><input type="text" id="addyjcz09060"/></td></tr>
	<tr><%--<td>家庭电话</td><td><input type="text" id="addyjcz09070"/></td>--%>
	<td>邮编</td><td><input type="text" id="addyjcz09080"/></td><td>电子邮箱</td><td><input type="text" id="addyjcz09100"/></td></tr>
	<tr><td >通讯地址</td><td colspan="3"><input type="text" id="addyjcz09090" size="55"/></td></tr>
	<tr><td>值班人员职务</td><td><input type="text" id="addyjcz09110"/></td><td>备注</td><td><input type="text" id="addyjcz09120"/></td></tr>
	<tr id="btnTr">
	
	<td colspan="4" align="center"><input  type="button" value="保存" class="btn_2z"
					onclick="addNewZBRY()" />
					<input type="button" value="重置" class="btn_2z"
					onclick="resetEvent()" /></td></tr>
	</table>
	</div>
	
	<div  id="detailsDialog_zbry" style="padding:5px;width:500px;height:300px;" >
	<input type="hidden" id="yjcz09000"/>
	<input type="hidden" id="yjcz09010"/>
	<table>
	
	<tr><td>值班单位</td><td><input type="text" id="yjcz09020"/></td><td>值班人员</td><td><input type="text" id="yjcz09030"/></td></tr>
	<tr><td>移动电话</td><td><input type="text" id="yjcz09035"/></td><td>性别</td><td><input type="text" id="yjcz09040"/></td></tr>
	<tr><td>办公电话</td><td><input type="text" id="yjcz09050"/></td><td>办公传真</td><td><input type="text" id="yjcz09060"/></td></tr>
	<tr><td>值班人员职务</td><td><input type="text" id="yjcz09110"/></td><td>邮编</td><td><input type="text" id="yjcz09080"/></td></tr>
	<tr><td>通讯地址</td><td><input type="text" id="yjcz09090"/></td><td>电子邮箱</td><td><input type="text" id="yjcz09100"/></td></tr>
	<tr><td >备注</td><td colspan="3"><input type="text" id="yjcz09120"/></td></tr>
	<tr id="btnTr">
	
	<td colspan="2" align="right"><input id="submitBtn"  type="button" value="保存" class="btn_2z"
					onclick="updateZBRY()" /></td>
					<td colspan="2"><input type="button" id="resetBtn" value="重置" class="btn_2z"
					onclick="resetEvent()" /></td></tr>
	</table>
	</div>
	<div  id="Dialog_addPbjl" style="padding:5px;width:540px;height:330px;">
	<input type="hidden" id="addyjcz10000"/>
					<select style="display: none" id="sheng" onchange="changeShengItem(this.value,'addshi')"><option  selected="selected" value="" >请选择省</option></select>
					<table class="innerStyle" style="width:100%;margin-top: 5px;margin-left: 5px">
	<tr><td>省市区划</td>
	<td><select id="addshi_zbgl" 	onchange="changeShiItem(this.value,'addxian_zbgl');loadZBRYSlt('sheng',this.value)">
	<option  selected="selected" value="-1">湖北省</option></select>
	<td>县级区划</td><td>
	<select id="addxian_zbgl" onchange="loadZBRYSlt('addshi_zbgl',this.value)">
	<option  selected="selected" value="-1">请选择县</option></select></td></tr>
	<tr><td>值班日期（起）</td>
	<td><input class="Wdate" 
	 onfocus="WdatePicker({startDate:'<%=time %>',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" value="<%=time %>" type="text" id="addyjcz10030"/></td>
	 <td>值班日期（止）</td>
	 <td><input class="Wdate" type="text" id="addyjcz10040"  onfocus="WdatePicker({startDate:'<%=time %>',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})"  value="<%=time %>"/></td></tr>
	
	<tr><td>值班单位</td><td><input type="text" id="addyjcz10020" readonly="readonly"/></td>
	<td>值班人员</td>
	<td><select id="addyjcz10050" onchange="getUnitByPerson(this.value)" > </select></td></tr>
	<tr><td>是否代班</td><td><input type="radio" name="addyjcz10010" value="1">是<input type="radio" name="addyjcz10010" value="0" checked="checked">否</td><td>带班领导</td><td><select id="addyjcz10060"  > </select></td></tr>
	<%--<tr><td>主管领导</td><td><select id="addyjcz10070"  > </select></td><td>分管领导</td><td><select id="addyjcz10080"  > </select></td></tr>--%>
	<tr><td>应急值班电话1</td><td><input type="text" id="addyjcz10090"/></td><td>应急值班电话2</td><td><input type="text" id="addyjcz10100"/></td></tr>
	<tr><td>应急值班电话3</td><td><input type="text" id="addyjcz10110"/></td><td>值班坐席编号</td><td><input type="text" id="addyjcz10120"/></td></tr>
	<tr><td>应急值班传真</td><td><input type="text" id="addyjcz10130"/></td><td>备注</td><td><input type="text" id="addyjcz10150"/></td></tr>
	<tr><td colspan="1">值班日志</td><td colspan="3"><input type="text" id="addyjcz10140" size="63" readonly="readonly"/></td></tr>
	<tr id="btnTr">
	
	<td colspan="4" align="center"><input  type="button" value="保存" class="btn_2z"
					onclick="addNewZBGL()" />
					<input type="button" value="重置" class="btn_2z"
					onclick="resetEvent()" /></td></tr>
	</table>
	</div>
	
	<div  id="detailsDialog_zbjl" style="width:580px;height:300px;" >
	<table >
	<input type="hidden" id="yjcz04id"/>
	<input type="hidden" id="yjcz04000"/>
	<tr><td>值班人员</td><td><input type="text" id="yjcz04020"/></td></tr>
	<tr><td>值班日期（起）</td>
	<td><input class="Wdate" 
	 onfocus="WdatePicker({startDate:'%y-%M-%d 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" type="text" id="yjcz04093"/></td>
	 <td>值班日期（止）</td>
	 <td><input class="Wdate" type="text" id="yjcz04094"  onfocus="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})"/></td></tr>
	<tr><td>记录类别</td><td colspan="3"><input type="radio" name="leibie" class="leibie" value="0">无灾&nbsp;<input type="radio" name="leibie" class="leibie" value="1">有灾&nbsp;<input type="radio" name="leibie" class="leibie" value="2">其他&nbsp;</td></tr>
	<tr><td>值班日志</td><td colspan="3"><textarea  id="yjcz04092" style='width:100%;height: 60px' /></textarea></td></tr>
	<tr><td>应急处置</td><td colspan="3"><textarea  id="yjcz04095" style='width:100%;height: 60px' /></textarea></td></tr>
	<tr id="btnTr">
	
	<td colspan="2" align="right"><input id="submitBtn_zbjl"  type="button" value="保存" class="btn_2z"
					onclick="updateZBJL()" /></td>
					<td colspan="2"><input type="button" id="resetBtn_zbjl" value="重置" class="btn_2z"
					onclick="resetEvent()" /></td></tr>
	</table>
	</div>
	
	
	<div  id="zbtj_charDlg" style="width:480px;height:350px;" >
		<div id="zbtj_charDiv" align="center"></div>
	</div>
	
	</body>
</html>
